﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls;
using LIM.controller;

namespace LIM.forms
{
    public partial class radForm_CRM_DanhSachKhachHang : Telerik.WinControls.UI.RadForm
    {
        public radForm_CRM_DanhSachKhachHang()
        {
            InitializeComponent();
        }
        DanhMucKhachHangController controller = new DanhMucKhachHangController();

        private void radForm_CRM_DanhSachKhachHang_Load(object sender, EventArgs e)
        {
            radGridView2.DataSource = controller.Load();
        }

        private void radMenuItem_Refresh_Click(object sender, EventArgs e)
        {
            radForm_CRM_DanhSachKhachHang_Load(sender, e);
        }

        private void radGridView2_CellDoubleClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
        {
            if (radGridView2.SelectedRows.Count > 0)
            {
                if (radGridView2.SelectedRows[0].Cells[0].Value != null)
                {
                    radForm_CRM_KhachHang_ChiTiet frm = new radForm_CRM_KhachHang_ChiTiet();
                    frm.IDKhachHang = int.Parse(radGridView2.SelectedRows[0].Cells[0].Value.ToString());
                    frm.KhachHangController = controller;
                    frm.MdiParent = this.MdiParent;
                    frm.Text = radGridView2.SelectedRows[0].Cells[2].Value.ToString();
                    frm.Tag = frm.IDKhachHang;
                    frm.Show();
                }
            }
        }
    }
}
